DownloadableFile

class DownloadableFile(var id: String, fileName: String?, var status: DownloadStatus, downloadUrl: String? = null, fileSize: Long? = null, preview: ByteArray? = null, data: ByteArray? = null, var downloadProgress: Float = 0.0f) : BaseFile

Represents a downloadable file attachment within an IncomingAttachmentStatement.

This class holds the metadata and binary data for files exchanged in the conversation. Consumer applications can read fileName, data, and fileSize to access the file's content.

Constructors

Link copied to clipboard
constructor(id: String, fileName: String?, status: DownloadStatus, downloadUrl: String? = null, fileSize: Long? = null, preview: ByteArray? = null, data: ByteArray? = null, downloadProgress: Float = 0.0f)

Properties

Link copied to clipboard

The file content, or null if the file hasn't been downloaded. Always null for received videos, which are streamed from downloadUrl instead of downloaded.

Link copied to clipboard

Download progress. A fraction from 0.0 to 1.0 when the file size is known. -1.0 while a video preview is retrieved or a download URL is refreshed.

Link copied to clipboard

The URL the file can be downloaded from, or null if not available.

Link copied to clipboard

The name of the file, including its extension, or null if unknown.

Link copied to clipboard

The size of the file in bytes, or null if unknown.

Link copied to clipboard

The type of the file, determined from the extension of fileName.

Link copied to clipboard
var id: String

Unique identifier of the attachment.

Link copied to clipboard

Preview image bytes: the image itself for image files, or a frame extracted from the video for video files. null if no preview is available.

Link copied to clipboard

The current download status of the file.

Functions

Link copied to clipboard
open operator override fun equals(other: Any?): Boolean

Two files are equal when their id, fileName, status, downloadUrl, downloadProgress, fileSize, preview, and data are equal.

Link copied to clipboard
open override fun hashCode(): Int

Returns a hash code based on id.